#!/usr/bin/python

"""StructException - Exceptions thrown by structs."""

class InvalidStringError(ValueError):
	"""Raised when a string cannot be parsed properly."""
	def __init__(T, message="Error parsing String", bytes=None):
		"""Initialize exception with string that caused error and messege about what caused it."""
		T.messege=messege
		T.bytes=bytes
	def __str__(T):
		"""Representation of Exception as a string."""
		if bytes:
			return "InvalidStringError: "+T.message+" string size: "+len(T.bytes)+" `"+T.bytes+"'"
		else:
			return "InvalidStringError: "+T.message+" Null string encountered."
	def __repr__(T):
		"""Representation of Exception as a string."""
		__str__()
